#include <iostream>
#include <stdlib.h>

using namespace std;

typedef struct NODE
{
    int no;
    int score;
    struct NODE *next;
} Node,*pNode;

void main ( )
{
    pNode head=NULL, s, p, pre;

    int i=0;

    while(i++<10)
    {
        s=(pNode)malloc(sizeof(Node));
        s->next=NULL;

        printf("the score of %d stucent",i);
        scanf("%d%d",&s->no,&s->score);


        if(head==NULL)
        {
            head=s;
        }
        else
        {
            p=head;
            pre=p;
            while((p!=NULL)&&(s->score<p->score))
            {
                pre=p;
                p=p->next;
            }
            if(p==head)
            {
                s->next=head;
                head=s;
            }

            else if(p==NULL)
            {
                s->next=pre->next;
                pre->next=s;
            }
        }
    }

    printf("\n enter the sort:\n");
    p=head;
    while(p!=NULL)
    {
        printf("(%d)-->%d \n",p->no,p->score);
        p=p->next;
    }

    system("pause");
}


